package com.aoip.telemetry.telemetry.entity.enums;

import com.aoip.telemetry.telemetry.entity.common.CacheKeyEntity;

import java.util.ArrayList;
import java.util.List;

/**
 * jvm 缓存中数据的key
 *
 * @author chenbai
 * @version 1.0
 * @date 2022/1/5 15:31
 */
public enum CacheKeyEnum {
    /**
     * jvm 缓存中数据的key
     *
     * @date 2022/1/5
     **/
    STATION("STATION", "接入测站"),
    REL_ST_ANALYSIS_GROUP("REL_ST_ANALYSIS_GROUP", "测站与解析组关联关系"),
    ANALYSIS_GROUP("ANALYSIS_GROUP", "解析组信息(含要素id)"),
    ELEMENT("ELEMENT", "各个要素的解析信息"),
    ELEMENT_ADDITION_FILED("ELEMENT_ADDITION_FILED", "元素解析入库需要补齐字段的配置信息，如监测点编码，时间等"),
    WS_RTU_ANALYSIS_ORDER("WS_RTU_ANALYSIS_ORDER", "水资源协议，rtu解析顺序配置信息"),
    PIPELINE_HANDLE("PIPELINE_HANDLER", "处理器解析配置信息表"),
    REL_ST_PIPELINE_HANDLE("REL_ST_PIPELINE_HANDLE", "测站与处理器解析配置关联关系表"),
    PIPELINE_HANDLE_TABLE("PIPELINE_HANDLE_TABLE", "处理器关联遥测库表配置关系信息"),
    PROTOCOL("PROTOCOL", "接收解析协议"),
    MERGE_DATA("MERGE_DATA", "监测数据字段合并配置"),
    ORIGINAL_MSG("ORIGINAL_MSG", "原始报文"),
    COMPUTE_MODEL("COMPUTE_MODEL", "计算模型"),
    REL_COMPUTE_MODEL("REL_COMPUTE_MODEL", "测站与计算模型关联关系"),
    CONFIRM_ST_COUNTER("CONFIRM_ST_COUNTER", "测站确认报文计数值"),
    REL_ST_PIPELINE_HANDLE_ST("REL_ST_PIPELINE_HANDLE_ST", "测站与处理器解析配置关联关系测站表"),
    STATION_ONLINE_STATUS("STATION_ONLINE_STATUS", "测站在线状态"),
    STATION_ONLINE_STATUS_HIS("STATION_ONLINE_STATUS_HIS", "测站在线状态历史信息"),
    ORDER_SEND_CN("ORDER_SEND_CN", "召测指令CN通讯值"),
    ORDER_NO_SEND_STORE_HOUSE("ORDER_NO_SEND_STORE_HOUSE", "指令未发送仓库"),
    LATEST_REPORT_TIME("LATEST_REPORT_TIME", "测站最新上报时间"),
    ST_GP_ABNO_INFO("ST_GP_ABNO_INFO", "测站异常信息"),
    DATA_MERGE_RULE_GROUP("DATA_MERGE_RULE_GROUP", "数据合并规则组信息表"),
    DATA_MERGE_RULE_DETAIL("DATA_MERGE_RULE_DETAIL", "数据合并规则组信息表"),
    REL_ST_DATA_MERGE("REL_ST_DATA_MERGE", "测站关联数据合并规则组关联关系表"),
    HAS_MERGE_DATA("HAS_MERGE_DATA", "已经合并的监测数据"),
    MQ_CONSUME_FAIL("MQ_CONSUME_FAIL", "消息队列消费失败"),
    CLIENT_IP_PORT("CLIENT_IP_PORT", "客户端IP端口"),
    BLACK_ST_CODE("BLACK_ST_CODE", "黑名单测站，用于记录发送次数"),
    BLACK_ST_CODE_LIST("BLACK_ST_CODE_LIST", "黑名单测站列表"),
    ;

    /**
     * @category 编码
     */
    private String code;

    /**
     * @category 说明
     */
    private String msg;

    CacheKeyEnum(String code, String msg) {
        setCode(code);
        setMsg(msg);
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }


    public static List<CacheKeyEntity> toList() {
        List<CacheKeyEntity> list = new ArrayList<>();
        for (CacheKeyEnum cacheKeyEnum : CacheKeyEnum.values()) {
            list.add(new CacheKeyEntity(cacheKeyEnum.getCode(), cacheKeyEnum.getMsg()));
        }
        return list;
    }
}
